/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pope.jloading.mycell;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author zouxw pope945@gmail.com
 */
public class ProgressBarRenderer extends JProgressBar implements TableCellRenderer{
    Color color = new Color(43,133,43);//Green 进度
    public ProgressBarRenderer() {
        super();
        setStringPainted(true);
    }
    public Component getTableCellRendererComponent(JTable table, 
            Object value,
            boolean isSelected,
            boolean hasFocus,
            int row, int column) {
        if (isSelected) {
            setForeground(color);
            setBackground(table.getSelectionBackground());
        } else {
            setForeground(color);
            setBackground(table.getBackground());
//            setBackground(Color.gray);
        }
        int val = (Integer) value;
        setValue(val);
        
        return this;
    }
}
